import http from '../utils/request'
import {AxiosResponse} from 'axios'
interface Iadmin{
    (sitename: string,url: string,keywords: string,desc: string,copyright:string,appid: string,appsecret: string,miniappid: string,minisecret: string):Promise<AxiosResponse<any>>
  }
const count:Iadmin = (sitename: string,url: string,keywords: string,desc: string,copyright:string,appid: string,appsecret: string,miniappid: string,minisecret: string):Promise<AxiosResponse<any>> => {
    return http.post('/systemctl/settinglist/edit',{sitename,url,keywords,desc,copyright,appid,appsecret,miniappid,minisecret})
  }
  const field = ():Promise<AxiosResponse<any>> => {
    return http.get('/systemctl/field',{})
  }
  const adddata = (	fieldname:string,id:number,is_null:string):Promise<AxiosResponse<any>> => {
    return http.post('/systemctl/edit',{fieldname,id,is_null})
  }
  const dele = (id:number):Promise<AxiosResponse<any>> => {
    return http.get('/systemctl/delField',{id})
  }


  const getcharlist=():Promise<AxiosResponse<any>> => {
    return http.get('/department/list',{})
  }
  const getadminlist=():Promise<AxiosResponse<any>> => {
    return http.get('/admin/list',{})
  }

  interface addhouse{
    (name: string,num: string,openid: string,parent_id: number,user:string,user_mobile: string):Promise<AxiosResponse<any>>
  }
  const addhouse=(name: string,num: string,openid: string,parent_id: number,user:string,user_mobile: string):Promise<AxiosResponse<any>> => {
    return http.post('/department/add',{name,num,openid,parent_id,user,user_mobile})
  }

  interface Edithouse{
    (name: string,num: string,openid: string,parent_id: number,user:string,user_mobile: string,id?:number):Promise<AxiosResponse<any>>
  }
  const edithouse:Edithouse=( name: string,num: string,openid: string,parent_id: number,user:string,user_mobile: string,id?:number):Promise<AxiosResponse<any>> => {
    return http.post('/department/edit',{name,num,openid,parent_id,user,user_mobile,id})
  }
  interface Delhouse{
    (id:number):Promise<AxiosResponse<any>>
  }
  const delhouse:Delhouse=( id:number):Promise<AxiosResponse<any>> => {
    return http.get('/department/del',{id})
  }
export default {
    count,
    field,
    adddata,
    dele,
    getcharlist,
    getadminlist,
    addhouse,
    edithouse,
    delhouse
}